// **********************************************************************
//                            Project Nitro
//                        ---------------------
//
//  File        : WorldDisplay.h
//  Description : Display world (level, cars, ...)
//  Author      : Guillaume Delhumeau <guillaume.delhumeau@gmail.com>
//  License     : GNU General Public License 3
//
// **********************************************************************

#ifndef _WORLD_DISPLAY_H_
#define _WORLD_DISPLAY_H_

/************************************************************************/
/* Includes                                                             */
/************************************************************************/
#include <list>
#include "Maths/Vector.h"

/************************************************************************/
/* Class used (not included since we just use them with pointers        */
/* to avoid too much .h dependencies)                                   */
/************************************************************************/
class Level;
class Car;
class Screen;

/************************************************************************/
/* Class                                                                */
/************************************************************************/
class WorldDisplay{

public:
	WorldDisplay(Screen & screen);

	inline void set_level(Level * p_level){_p_level = p_level;}

	inline void set_main_car(Car * p_main_car){_p_main_car = p_main_car;}

	void draw();

private:
	Screen & _screen;
	Level * _p_level;
//	std::list<Car*>	_cars;
	Car * _p_main_car;
	Vector4f _main_car_pos;

	real _scroll_x;
	real _scroll_y;

	int _screen_width;
	int _screen_height;

	void _compute_scrolling();

	void _compute_scrollong_if_screen_resized();

	void _compute_scrolling_axis(int screen_size,
		real & scroll_axis,
		real car_pos,
		int map_size);

};

#endif